#ifndef REPORTEDITOR_H
#define REPORTEDITOR_H

#include <QWidget>
#include "reporteditor_global.h"
class DiagnosticTemplateModel;
class QJsonObject;
class QLabel;

namespace Ui {
class ReportEditor;
}

class REPORTEDITORSHARED_EXPORT ReportEditor : public QWidget
{
    Q_OBJECT

public:
    explicit ReportEditor(QWidget *parent = 0);
    ~ReportEditor();

signals:
    void reportSave(const QStringList &files);
    void postReport(const QByteArray &json);
    void downloadImages(const QStringList &images);

public slots:
    void openReport(const QByteArray &json);
    void openReportFile(const QString &json);
    void loadImage(const QString &png);
    void setCacheDir(const QString &dir);
    void clearReportImages();
    void setReadOnly(bool yes);
    void setStatus(int status);

protected:
    void closeEvent(QCloseEvent *e);

private slots:
    void on_settingsBtn_clicked();
    void onReportModified(bool yes) { modified = yes; }
    void on_imageBtn_clicked();
    void onReportCompleted(bool yes);
    void onReportVerified(bool yes);
    void onTitleChanged(const QString &title);
    void onReportNotify(const QByteArray &json);

private:
    void setupComponent();
    void setupToolBar();
    void setupConnection();

    Ui::ReportEditor *ui;
    DiagnosticTemplateModel *tempModel;
    bool modified;

};

#endif // REPORTEDITOR_H
